export default function createElement(type, props, ...children) {

    const childElements = [].concat(children).reduce((res, child) => {
        // 去除布尔值和null (布尔值和null在页面中不显示)
        if (typeof child !== 'boolean' && child !== null && child !== undefined) {
            if (child instanceof Object) {
                res.push(child)
            } else {
                res.push(createElement('text', {
                    textContent: child
                }))
            }
        }
        return res
    }, [])
    return {
        type,
        props: {
            ...props,
            children: childElements
        },
        children: childElements
    }
}